package com.gjy.amqp.util;

import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

/**
 * @author gjy
 * @version 1.0
 * @since 2025-05-17 11:16:16
 */
public class RabbitmqUtil {

    private static final ConnectionFactory FACTORY = new ConnectionFactory();

    static {
        FACTORY.setHost("192.168.253.142");
        FACTORY.setPort(5672);
        FACTORY.setUsername("admin");
        FACTORY.setPassword("admin");
        FACTORY.setVirtualHost("/");
    }

    public static Connection connection() {
        Connection connection;
        try {
            connection = FACTORY.newConnection();
            return connection;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

}
